package model;

import java.util.HashSet;
import java.util.Set;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

public class AirPlane extends Model
{
	private String		mark;
	private int			minEmployee;
	private int			maxEmployee;
	private int			currentPosition;
	private boolean		saatsan;
	private String		saatsanComment;

	private Set<Fly>	flies	= new HashSet<Fly>();

	public static String getAirPlaneMark(Session session, AirPlane airPlane)
	{
		Criteria criteria = session.createCriteria(AirPlane.class);
		Criterion criterion = Restrictions.idEq(airPlane.getId());
		criteria.add(criterion);
		airPlane = (AirPlane) criteria.uniqueResult();
		return airPlane.getMark();
	}

	public static AirPlane getAirPlane(Session session, long id)
	{
		Criteria criteria = session.createCriteria(AirPlane.class);
		Criterion criterion = Restrictions.idEq(id);
		criteria.add(criterion);
		return (AirPlane) criteria.uniqueResult();
	}

	public AirPlane()
	{
	}

	public String getMark()
	{
		return mark;
	}

	public void setMark(String mark)
	{
		this.mark = mark;
	}

	public int getMinEmployee()
	{
		return minEmployee;
	}

	public void setMinEmployee(int minEmployee)
	{
		this.minEmployee = minEmployee;
	}

	public int getMaxEmployee()
	{
		return maxEmployee;
	}

	public void setMaxEmployee(int maxEmployee)
	{
		this.maxEmployee = maxEmployee;
	}

	public int getCurrentPosition()
	{
		return currentPosition;
	}

	public void setCurrentPosition(int currentPosition)
	{
		this.currentPosition = currentPosition;
	}

	public boolean isSaatsan()
	{
		return saatsan;
	}

	public void setSaatsan(boolean saatsan)
	{
		this.saatsan = saatsan;
	}

	public String getSaatsanComment()
	{
		return saatsanComment;
	}

	public void setSaatsanComment(String saatsanComment)
	{
		this.saatsanComment = saatsanComment;
	}

	public Set<Fly> getFlies()
	{
		return flies;
	}

	public void setFlies(Set<Fly> flies)
	{
		this.flies = flies;
	}
}